import { createApp } from "vue";
import "./style.css";
import "@/assets/css/public.css";
import { createPinia } from "pinia"; // 导入 Pinia
import App from "./App.vue";
import router from "./router/index";

// main.ts
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.less";

import zhCN from "ant-design-vue/es/locale/zh_CN";
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";

dayjs.locale("zh-cn");

const app = createApp(App);
const pinia = createPinia();

app.use(pinia); // 必须在路由之前注册
app.use(router);

app.use(Antd);

//  全局设置 Ant Design Vue 中文
app.config.globalProperties.$ANTD_LANG = zhCN; // Vue 3 全局变量方式（可选）
app.provide("ANTD_LANG", zhCN); // 或使用 provide/inject

// ConfigProvider
import { ConfigProvider } from "ant-design-vue";
app.use(ConfigProvider, {
  locale: zhCN, // 关键！设置组件 UI 为中文
});

app.mount("#app");
